package com.lhb.SC.web.context;

import java.util.Date;

import lombok.Data;

@Data
public class ResponseResult<T> {

	private boolean success;
	private String code;
	private String message;
	private Date date;
	private T data;

	public ResponseResult() {
		super();
	}

	public ResponseResult(boolean success, T data) {
		this();
		this.success = success;
		this.data = data;
	}

	public ResponseResult(boolean success, String code, String message, T data) {
		this.success = success;
		this.code = code;
		this.message = message;
		this.data = data;
	}

	public static <T> ResponseResult<T> success(T data) {

		return new ResponseResult<T>(true, null, null, data);
	}

	public static <T> ResponseResult<T> fail(String code, String message) {

		return new ResponseResult<T>(false, code, message, null);
	}
	
}
